<h2>Blacklisted Domains</h2>
<?php
    $this->headTitle('Blacklisted Domains');
    $this->headScript()->appendFile('/js/BizSense/Crud.js');
    $acl = $this->acl;    
?>

<?php if ($acl->isAllowed($this->currentUser, 'access newsletter pages')): ?>
<a href="<?php echo $this->url(array(
        'module'    =>'newsletter',
        'controller'=>'index',
        'action'    =>'index'
        ), null, true); ?>">Newsletter</a>
<?php endif; ?>  |

<?php if  ($acl->isAllowed($this->currentUser, 'access newsletter pages')): ?>
<a href="<?php echo $this->url(array(
    'module'    =>'newsletter', 
    'controller'=>'settings',
    'action'    =>'index'
    )
  , null, true); ?>">Settings</a>
  |
<?php endif; ?>


<?php if  ($acl->isAllowed($this->currentUser, 'access newsletter pages')): ?>
<a href="<?php echo $this->url(array(
    'module'    =>'newsletter', 
    'controller'=>'domainblacklist',
    'action'    =>'create'
    )
  , null, true); ?>">Add domain to blacklist</a>
<?php endif; ?>

<?php if (count($this->paginator)): ?>
<table class="data_table">
    <tr>
        <th>Name</th>
       <th>Action</th>
    </tr>
<?php foreach ($this->paginator as $item): ?>
<?php $item = $item->toArray(); ?>
    <tr>
        <td><?php echo $this->escape($item['domain']); ?></td>
        <td>
            <a href="<?php echo $this->url(
                array
                (
                    'module' => 'newsletter',
                    'controller' => 'domainblacklist',
                    'action' => 'edit',
                    'domain_blacklist_id' => $item['domain_blacklist_id']
                ), 'default', true
            ); ?>">Edit</a>
            <?php 
                $deleteUrl = $this->url(
                    array(
                        'module' => 'newsletter',
                        'controller' => 'domainblacklist',
                        'action' => 'delete',
                        'domain_blacklist_id' =>$this->escape($item['domain_blacklist_id'])
                    )
                );
                echo $this->deleteButton($deleteUrl); 
             ?>
         </td>
    </tr>
<?php endforeach; ?>
</table>
<?php endif; ?>

<?php
    if ($this->wasSearched and !count($this->paginator)) {
        echo "<br />There are no records matching the search criteria";
    }
?>

<div class="pagination">
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'search.phtml'); ?>
</div>
<div class="div_clear"></div>

